package utils.json.data.backbone;

import com.google.gdata.data.appsforyourdomain.provisioning.UserEntry;

import models.User;
import utils.json.data.AbstractJson;

public class UserJson extends AbstractJson {
	public UserJson(User user) {
		put("id", user.getId());
		put("firstName", user.getProfile().getFirstName());
		put("lastName", user.getProfile().getLastName());
		put("email", user.getProfile().getEmail());
		put("access", user.hasAccess());
		put("profileId", user.getProfile().getId());
	}

	public UserJson(UserEntry userEntry) {
		put("firstName", userEntry.getName().getGivenName());
		put("lastName", userEntry.getName().getFamilyName());
		put("userName", userEntry.getLogin().getUserName());
		put("access", false);
		put("profileId", userEntry.getId());
	}
}
